package com.indexingsystem.boss.admin.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.indexingsystem.boss.Vo.OrderAddProductInitVo;
import com.indexingsystem.boss.Vo.OrderCateReqVo;
import com.indexingsystem.boss.Vo.OrderProductListQueryVo;
import com.indexingsystem.boss.Vo.ResCategorsRelationQueryVo;
import com.indexingsystem.boss.Vo.ResCategoryOrderQueryVo;
import com.indexingsystem.boss.Vo.ResRelationQueryVo;
import com.indexingsystem.boss.Vo.ResourceCategorsSortVo;
import com.indexingsystem.boss.Vo.ResourceCategorsVo;
import com.indexingsystem.boss.Vo.ResourceCategoryAdditionalVo;
import com.indexingsystem.boss.Vo.ResourceRelationInfoVo;
import com.indexingsystem.boss.Vo.TreeOrderQueryVo;
import com.indexingsystem.boss.Vo.TreeParentOrderQueryVo;
import com.indexingsystem.boss.Vo.TreeQueryVo;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.ResourceCategors;

@Repository
public interface ResourceCategorsMapper {
	/**
	 * 批量删除资源分类.
	 * 
	 * @param resCategoryIdList
	 * @return
	 */
	int deleteResourceCategorsByIdBatch(@Param("list") List<String> list);

	/**
	 * 通过资源分类id删除资源分类.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	int deleteByPrimaryKey(String resCategoryId);

	/**
	 * 新增资源分类信息.
	 * 
	 * @param record
	 * @return
	 */
	int insert(ResourceCategors record);

	/**
	 * 带条件新增资源分类.
	 * 
	 * @param record
	 * @return
	 */
	int insertSelective(ResourceCategors record);

	/**
	 * 通过资源分类id获取资源分类详情.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	ResourceCategorsVo getResCategoryById(String resCategoryId);
	
	/**
	 * 栏目管理：只显示有资源的资源分类.
	 * @param list
	 * @return
	 */
	List<ResourceCategorsVo> getMenuResourceCategorsTreeList(@Param("list")List<String> list);
	
	
	/**
	 * 通过资源分类id查询资源分类详情.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	ResourceCategors selectByPrimaryKey(String resCategoryId);

	/**
	 * 获取父级最大排序值
	 * 
	 * @param resCategoryId
	 * @return
	 */
	String getParentCategorySortMax(String resCategoryId);

	/**
	 * 修改资源分类信息.
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKeySelective(ResourceCategors record);

	/**
	 * 全量修改资源分类.
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKey(ResourceCategors record);

	/**
	 * 获取资源分类列表.
	 * 
	 * @return
	 */
	List<ResourceCategors> selectResourceCategorsList();

	/**
	 * 通过是否为连续出版物过滤资源
	 * 
	 * @param request
	 * @return
	 */
	List<ResourceCategorsVo> getPublications(OrderCateReqVo orderCateReqVo);

	/**
	 * 获取资源分类上下级列表信息.
	 * 
	 * @return
	 */
	List<ResourceCategorsVo> getResourceCategorsList();

	/**
	 * 获取资源分类上下级列表信息.
	 * 
	 * @return
	 */
	List<ResourceCategors> getResourceCategorsByIdList(TreeQueryVo treeReqVo);

	/**
	 * 获取资源分类总数量.
	 * 
	 * @return
	 */
	Integer getResourceCategorsListCount();

	/**
	 * 获取子资源分类总数.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	Integer getSublevelResourceCategorsListSize(TreeQueryVo treeReqVo);

	/**
	 * 判断资源分类名称是否已存在
	 * 
	 * @param resourceCategors
	 * @return
	 */
	ResourceCategors selectResourceCategorsExits(String resName);

	/**
	 * 通过资源分类排序查询资源分类排序是否重复.
	 * 
	 * @param categoryOrder
	 * @return
	 */
	ResourceCategors selectResourceCategorsOrderNumberExits(String categoryOrder);

	/**
	 * 通过资源分类id查询资源分类包含的资源明细列表.
	 * 
	 * @param resCategoryId
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	List<ResourceRelationInfoVo> getResourceRelationInfoVoListByResCategoryId(ResRelationQueryVo resRealtionQueryVo);
	
	/**
	 * 产品管理：资源分类中获取所有子级分类含自己的所有资源并去重资源列表总数量.
	 * @param resCategorsRelationQueryVo
	 * @return
	 */
	Integer getResourceCategorsResRelationByResCategoryIdListCount(ResCategorsRelationQueryVo resCategorsRelationQueryVo);
	
	
	
	
	/**
	 * 产品管理：资源分类中获取所有子级分类含自己的所有资源并去重资源列表.
	 * @param resCategorsRelationQueryVo
	 * @return
	 */
	List<ResourceRelationInfoVo> getResourceRelationInfoVoListByResCategoryIdlist(ResCategorsRelationQueryVo resCategorsRelationQueryVo);	

	/**
	 * 获取资源分类中资源关系资源列表总数量.
	 * 
	 * @return
	 */
	Integer getResourceCategorsResRelationListCount(ResRelationQueryVo resRealtionQueryVo);

	/**
	 * 获取子资源分类订单未购买总数.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	Integer getNotBugSublevelResourceCategorsListSize(TreeOrderQueryVo treeOrderQueryVo);

	/**
	 * 通过订单id、选择的分类id查询订单未购列表.
	 * 
	 * @param treeOrderQueryVo
	 * @return
	 */
	List<ResourceCategors> selectNotBugSublevelResourceCategorsList(TreeOrderQueryVo treeOrderQueryVo);

	/**
	 * 非连续出版物类型通过资源分类id获取分类中所有资源的开始年份、结束年份、价格总合附加属性.
	 * 
	 * @param resCategoryId
	 * @return
	 */
	ResourceCategoryAdditionalVo getResCategoryAddiionalByResCateId(OrderProductListQueryVo  orderProductListQueryVo);

	/**
	 * 资源分类排序获取自身或目录排序资源分类列表.
	 * 
	 * @param resCategoryOrderQueryVo
	 * @return
	 */
	List<ResourceCategors> getResourceCategorsByCategoryOrder(ResCategoryOrderQueryVo resCategoryOrderQueryVo);

	/**
	 * 批量修改资源分类上移、下移操作.
	 * 
	 * @param list
	 * @return
	 * @throws Exception
	 */
	int updateBatchResCategors(@Param("list") List<ResourceCategors> list);
	
	
	/**
	 * 通过资源分类id所有子分类列表
	 * @param resCategoryId
	 * @return
	 */
    List<ResourceCategors> getResourceCategorsLists(String resCategoryId);
	
	
	/**
	 * 连续出版物类型通过资源分类id获取分类中所有资源的开始年份、结束年份、价格总合附加属性.
	 * 
	 * @param resCategoryId
	 * @return
	 */
    ResourceCategoryAdditionalVo getMagazinesResCategoryAddiionalByResCateId(OrderProductListQueryVo  orderProductListQueryVo);
	
    /**
     * 查询订单产品关系表中资源分类的所有子级分类.
     * @param categoryOrder
     * @return
     */
    List<ResourceCategors> getOrderResourceCategorsListByCategoryOrder(String categoryOrder);

	
	/**
	 * 通过资源分类id所有子分类列表
	 * @param resCategoryId
	 * @return
	 */
    List<ResourceCategors> getResourceCategorsParentList(String resCategoryId);
    
    
	/**
	 * 通过资源分类id列表获取加入订单初始化开始年份、结束年份连续出版物类型资源信息.
	 * @param resCategoryIdList
	 * @return
	 */
	OrderAddProductInitVo getMagazinesResCategoryProductInitInfo(@Param("list") List<String> list);
	
	
	/**
	 * 通过资源分类id列表获取加入订单初始化开始年份、预约结束年份非连续出版物类型资源信息.
	 * @param resCategoryIdList
	 * @return
	 */
	OrderAddProductInitVo getResCategoryProductInitInfo(@Param("list") List<String> list);
	
	
    /**
     * 产品管理树形中通过联系出版物或非连续出版物过滤分类.
     * @param isPublications
     * @return
     */
    List<ResourceCategorsVo> getResourceCategorsTreeList(Integer isPublications);
    
    /**
     * 子级机构获取父级订单已购总数.
     * @param treeOrderQueryVo
     * @return
     */
    Integer getParentNotBugSublevelResourceCategorsListSize(TreeParentOrderQueryVo treeParentOrderQueryVo);
    
    /**
     * 子级机构获取父级订单已购列表.
     * @param treeParentOrderQueryVo
     * @return
     */
    List<ResourceCategors> getParentNotBugSublevelResourceCategorsList(TreeParentOrderQueryVo treeParentOrderQueryVo);
    
    
    /**
     * 通过资源分类id校验资源分类是否有资源.
     * @param resCategoryId
     * @return
     */
    Integer getResourceCategorsResRelationByResCategoryIdExitsResource(String resCategoryId);
    
    
    /**
     * 查询订单产品关系表中资源分类的子级分类id.
     * @param categoryOrder
     * @return
     */
    List<String> getOrderResourceCategorsIdListByCategoryOrder(String categoryOrder);
    
    
    /**
     * 获取产品列表中资源分类
     * @param resCategoryIdList
     * @return
     */
    List<ResourceCategorsVo> getOrdersResourceCategorsTreeList(@Param("list") List<String> list);  
    
    
    /**
     * 通过资源idlist 获取所有子级分类的id集合.
     * @param resCategoryIdList
     * @return
     */
    List<ResourceCategors> getOrderResourceCategorsListByResCategoryIdList(@Param("list") List<String> list);



	List<ResourceCategors> getResourceCategorsListByCondition(ResourceCategorsSortVo resourceCategorsSortVo);

	void updateResourceCategorsListByCondition(ResourceCategorsSortVo resourceCategorsSortVo);
	
	
    
    /**
     * 通过订单id获取资源分类详情.
     * 
     * @param resCategoryId
     * @return
     */
	List<ResourceCategors> getResourceCategorsByOrderList(String orderId);

	ResourceCategors selectResourceCategorsByNameModel(ResourceCategors resourceCategors);
	String getCategorySortMax(String resCategoryId) ;
	
}